package io.renren.common.utils;


import java.text.SimpleDateFormat;
import java.util.Locale;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.Feature;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author: xiaomi
 * @date: 2021/5/26
 * @description:
 */
@Slf4j
public class JsonUtils {
    //    private static final Logger log = LoggerFactory.getLogger(JsonMapper.class);
    private static ObjectMapper objectMapper = new ObjectMapper();

    public JsonUtils() {
    }

    public static <T> String obj2String(T src) throws Exception {
        return JSON.toJSONString(src);
    }

    public static <T> T string2Obj(String src, TypeReference<T> typeReference) throws Exception {
        return JSON.parseObject(src, typeReference, new Feature[0]);
    }

}
